<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <title>订单</title>
        <@tools.includePlace path="/common/8ddab9ba-a8aa-4745-86c6-66bf1c2c976c.html"/> <#-- header -->
    </head>
    <body>
        <@tools.includePlace path="/common/c32a4f4a-ff5d-49cf-bb59-5d9784539174.html"/> <#-- 导航 -->

        <div class="banner-l3 position-relative d-flex align-items-center justify-content-center" style="background:#22407c url(${site.sitePath}assets/img/banner-l3-bg-1.png) 50% 50% no-repeat;">
            <div class="container text-center position-relative py-3 py-md-4 text-white">
                <div class="breadcrumbs fs-7 text-white d-inline-flex align-items-center text-opacity-50">
                    <a href="${site.sitePath}">首页</a> &gt; <a href="${site.dynamicPath}member/orderList.html" data-id="member">${(metadata.alias)!}</a>
                </div>
            </div>
        </div>

        <div class="container">
            <div class="row gx-5 justify-content-between my-5">
                <@tools.includePlace path="/c936c718-5f19-426f-b3ff-13a5a8d63044.html"/> <#-- 个人中心导航 -->
                <div class="col-md-9">
                    <div class="ps-4">
                        <h3>订单</h3>
                        <@import path="/ftl/tools.ftl" namespace="t"/><#-- 工具 -->
                        <#if orderId?has_content>
                        <@trade.order id=orderId>
                            <p>
                                <label class="input-label">订单状态:</label><span class="text"><@t.m 'page.status.order.'+object.status/></span>
                                <label class="input-label">已确认:</label><span class="text">${object.confirmed?then('是','否')}</span>
                                <label class="input-label">已处理:</label><span class="text">${object.processed?then('是','否')}</span>
                            </p>
                        <#if object.processed><p><label class="input-label">发货信息:</label><span class="text">${object.processInfo!}</span><span class="text">${object.processDate!} </span></p></#if>
                            <p>
                                <label class="input-label">收件人:</label><span class="text">${object.addressee!}</span>
                                <label class="input-label">联系电话:</label><span class="text">${object.telephone!}</span>
                            </p>
                            <p>
                                <label class="input-label">邮寄地址:</label><span class="text">${object.address!}</span>
                            </p>
                            <p><label class="input-label">备注:</label><span class="text">${object.remark!}</span></p>
                            <p><label class="input-label">总金额:</label><span class="text">${object.amount!}</span></p>
                            <@trade.orderProductList orderId=orderId>
                                <#list page.list as op>
                                <@cms.content id=op.contentId>
                                    <p>
                                        <#if object.cover?has_content><img src="${object.cover}" style="max-width:200px;max-height:200px;border:1px solid;"/><br></#if>
                                        <a href="${object.url}" target="_blank">${object.title}</a>
                                    </p>
                                </@cms.content>
                                <@cms.contentProduct id=op.productId>

                                    <p>
                                        <#if object.cover?has_content><img src="${object.cover}" style="max-width:200px;max-height:200px;border:1px solid;"/><br></#if>
                                        型号：${object.title} 价格：${op.price} 备注：${op.remark!}
                                        数量：${op.quantity!}
                                    </p>
                                </@cms.contentProduct>
                                </#list>
                            </@trade.orderProductList>
                            <#if 0=object.status>
                                <#if object.paymentId?has_content>
                                    <a href="${site.dynamicPath}tradePayment/pay?paymentId=${object.paymentId}&returnUrl=https:${(site.dynamicPath+'order.html?orderId='+orderId)?url}">继续支付</a>
                                    <a href="${site.dynamicPath}tradePayment/cancel?paymentId=${object.paymentId}&returnUrl=https:${(site.dynamicPath+'order.html?orderId='+orderId)?url}&_csrf=<@tools.csrfToken/>">更换支付方式</a>
                                    <a href="${site.dynamicPath}tradeOrder/close?orderId=${object.id}&returnUrl=https:${(site.dynamicPath+'order.html?orderId='+orderId)?url}&_csrf=<@tools.csrfToken/>">关闭订单</a>
                                <#else>
                                <a href="${site.dynamicPath}tradeOrder/pay/alipay?orderId=${orderId!}&returnUrl=https:${(site.dynamicPath+'order.html?orderId='+orderId)?url}">支付宝支付</a> <a href="${site.dynamicPath}tradeOrder/pay/wechat?orderId=${orderId!}&returnUrl=https:${(site.dynamicPath+'order.html?orderId='+orderId)?url}">微信支付</a> <a href="${site.dynamicPath}tradeOrder/pay/account?orderId=${orderId!}&returnUrl=https:${(site.dynamicPath+'order.html?orderId='+orderId)?url}">账户余额支付</a>
                                </#if>
                            <#elseif 2=object.status && object.paymentId?has_content>
                                <form action="${site.dynamicPath}tradePayment/refund" method="POST">
                                    <input type="hidden" name="_csrf" value="<@tools.csrfToken/>"/>
                                    <input type="hidden" name="returnUrl" value="${site.dynamicPath}member/order.html?orderId=${object.id}"/>
                                    <input type="hidden" name="paymentId" value="${object.paymentId}"/>
                                    <label class="input-label">金额</label><input type="text" name="amount" required="required" value="${object.amount}" max="${object.amount}"/>
                                    <label class="input-label">原因</label><input type="text" name="reason" required="required"/>
                                    <input class="button" type="submit" value="申请退款"/>
                                </form>
                            </#if>
                        </@trade.order>
                        <#else>
                        <#if productId?has_content && quantity?has_content && productId?size=quantity?size>
                        <form action="${site.dynamicPath}tradeOrder/create" method="POST">
                            <input type="hidden" name="_csrf" value="<@tools.csrfToken/>"/>
                            <input type="hidden" name="returnUrl" value="${site.dynamicPath}member/order.html"/>
                            <input type="hidden" name="orderIdField" value="orderId"/>
                            <p><label class="input-label">邮寄地址</label><input type="text" name="address" required="required"></p>
                            <p><label class="input-label">收件人</label><input type="text" name="addressee" required="required"></p>
                            <p><label class="input-label">联系电话</label><input type="text" name="telephone" required="required"></p>
                            <p><label class="input-label">备注</label><input type="text" name="remark" required="required"></p>
                                <#list productId as p>
                                    <@cms.contentProduct id=p;product>
                                        <@cms.content id=product.contentId>
                                            <p>
                                                <#if object.cover?has_content><img src="${object.cover}" style="max-width:200px;max-height:200px;border:1px solid;"/></#if>  <a href="${object.url}" target="_blank">${object.title}</a>
                                            </p>
                                            <#if p?is_first><input type="hidden" name="title" value="${object.title} - ${product.title}"/></#if>
                                        </@cms.content>
                                        <p>
                                            <#if product.cover?has_content><img src="${product.cover}" style="max-width:200px;max-height:200px;border:1px solid;"/><br></#if>
                                            型号：${product.title} 价格:${product.price} 库存:${product.inventory}
                                        </p>
                                    <p>
                                        <input type="hidden" name="tradeOrderProductList[${p?index}].contentId" value="${product.contentId}"/>
                                        <input type="hidden" name="tradeOrderProductList[${p?index}].productId" value="${product.id}"/>
                                        <label class="input-label">数量</label><input type="text" name="tradeOrderProductList[${p?index}].quantity" value="${quantity[p?index]}" required="required"/>
                                        <label class="input-label">备注</label><input type="text" name="tradeOrderProductList[${p?index}].remark" required="required"/>
                                    </p>
                                    </@cms.contentProduct>
                                </#list>
                                <p><input class="button" type="submit" value="提交订单"/></p>
                            </form>
                            <#else>
                            参数错误
                            </#if>
                        </#if>
                    </div>
                </div>
            </div>
        </div>
		<script>
			var itemString="itemType=user&itemId=${user.id}";
			var templatePath='${.current_template_name?keep_after('/')}';
		</script>
        <@tools.includePlace path="/footer/7f8bacb5-30ca-4641-b66f-987d447b1a85.html"/> <#-- footer -->
    </body>
</html>
